package com.example.entry;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

public class HeaderEntry {

    private  StringProperty name;

    private  StringProperty value;

    private boolean isGlobal = false;  // 添加全局配置标记

    public HeaderEntry() {
        this("", "");
    }

    public HeaderEntry(String name, String value) {
        this.name = new SimpleStringProperty(name);
        this.value = new SimpleStringProperty(value);
    }

    public StringProperty nameProperty() {
        return name;
    }
    public StringProperty valueProperty() {
        return value;
    }

    // 用于JSON序列化
    public String getName() {
        return name.get();
    }

    public void setName(String name) {
        if (this.name != null) {
            this.name.set(name);
        } else {
            this.name = new SimpleStringProperty(name);
        }
    }

    public String getValue() {return value.get();}

    public void setValue(String value) {
        if (this.value != null) {
            this.value.set(value);
        } else {
            this.value = new SimpleStringProperty(value);
        }
    }

    // 添加全局配置相关的方法
    public boolean isGlobal() {
        return isGlobal;
    }

    public void setGlobal(boolean global) {
        this.isGlobal = global;
    }
}
